package com.example.Lezedata.util;

import android.content.SharedPreferences;
import android.os.Bundle;

import com.example.Lezedata.GBApplication;

import static android.content.Context.MODE_PRIVATE;

public class GBSaveData {
    public static SharedPreferences preferences = GBApplication.getContext().getSharedPreferences("GBData",MODE_PRIVATE);
    public static SharedPreferences.Editor editor = preferences.edit();
    public static GBSaveData newInstance() {
        GBSaveData fragment = new GBSaveData();
        return fragment;
    }

    public static void setData(String key, String string){
        editor.putString(key,string);
        editor.commit();
    }

    public static void setBoolData(String key, boolean data){
        editor.putBoolean(key,data);
        editor.commit();
    }

    public static boolean getBoolData(String key, boolean data){
        return preferences.getBoolean(key,data);
    }

    public static String getData(String key){
        return preferences.getString(key,"");
    }
}
